/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.kj.service;

import java.math.BigDecimal;
import java.util.List;

import com.jeesite.common.shiro.realms.Pa;
import com.jeesite.modules.kj.entity.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.kj.dao.KjMemberIntegralHistoryDao;

/**
 * kj_member_integral_historyService
 * @author hzy
 * @version 2021-07-04
 */
@Service
@Transactional(readOnly=true)
public class KjMemberIntegralHistoryService extends CrudService<KjMemberIntegralHistoryDao, KjMemberIntegralHistory> {

	/**
	 * 获取单条数据
	 * @param kjMemberIntegralHistory
	 * @return
	 */
	@Override
	public KjMemberIntegralHistory get(KjMemberIntegralHistory kjMemberIntegralHistory) {
		return super.get(kjMemberIntegralHistory);
	}

	/**
	 * 查询分页数据
	 * @param kjMemberIntegralHistory 查询条件
	 * @param kjMemberIntegralHistory.page 分页对象
	 * @return
	 */
	@Override
	public Page<KjMemberIntegralHistory> findPage(KjMemberIntegralHistory kjMemberIntegralHistory) {
		return super.findPage(kjMemberIntegralHistory);
	}

	/**
	 * 保存数据（插入或更新）
	 * @param kjMemberIntegralHistory
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(KjMemberIntegralHistory kjMemberIntegralHistory) {
		super.save(kjMemberIntegralHistory);
	}

	/**
	 * 更新状态
	 * @param kjMemberIntegralHistory
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(KjMemberIntegralHistory kjMemberIntegralHistory) {
		super.updateStatus(kjMemberIntegralHistory);
	}

	/**
	 * 删除数据
	 * @param kjMemberIntegralHistory
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(KjMemberIntegralHistory kjMemberIntegralHistory) {
		super.delete(kjMemberIntegralHistory);
	}

	//获得积分排行
	public List<MemberIntegralRank> getMemberIntegralRank(KjMemberIntegralHistory where){
		return dao.rank(where);
	}

	//某用户积分排行位置
	public MemberIntegralRank memberIntegralRankNum(KjMemberIntegralHistory where){
		return dao.memberIntegralRankNum(where);
	}


	//某用户捐赠积分排行位置
	public MemberIntegralRank memberContributeRankNum(KjMemberIntegralHistory kjMemberIntegralHistory){
		return dao.memberContributeRankNum(kjMemberIntegralHistory);
	}
	//捐赠积分排行
	public List<MemberIntegralRank> getMemberContributeRank(KjMemberIntegralHistory kjMemberIntegralHistory){
		return dao.contributeRank(kjMemberIntegralHistory);
	}

	//捐赠积分排行
	public List<MemberContributeProject> findMemberContributeProjects(String memberId, String year, String month){
		return dao.findMemberContributeProjects(memberId, year, month);
	}

	public List<TeamContributeRank> getTeamContributeRank(KjMemberIntegralHistory kjMemberIntegralHistory){
		return dao.teamContributeRank(kjMemberIntegralHistory);
	}


	public TeamContributeRank getMemberTeamContributeRank(KjMemberIntegralHistory kjMemberIntegralHistory){
		return dao.memberTeamContributeRankNum(kjMemberIntegralHistory);
	}


	//获取岗位总积分
	public BigDecimal getJobIntegrals(KjMemberIntegralHistory history){
		return dao.getJobIntegrals(history);
	}


	public StarLevelEntity getStarLevel(KjMemberIntegralHistory history){
		return dao.getStarLevel(history);
	}
}
